public class Op21 extends Operator{
	public Matrice execute(Matrice cc) {
		Matrice c=cc;
		int m[][]=c.getM();
		m[1][0]=1;
		c.setM(m);
		c.setNrReg(c.getNrReg()+1);
		return c;
	}
	public boolean valabil(Matrice c){
		boolean r=true;
		int m[][]=c.getM();
		//pe linie
		for(int j=0;j<m.length;j++)
			if(m[1][j]>0)
				r=false;
		//cautam pe coloana daca exista alta regina
		for(int j=0;j<m.length;j++)
			if(m[j][0]>0)
				r=false;
		//cautam pe diagonala principala daca exista o alta regina
		for(int i=2;i<m.length-1;i++)
			if(m[i][i-1]>0)
					r=false;
		//cautam pe diagonala secundara 
		if(m[0][1]>0)
			r=false;
		//verificam daca sunt toate cele 4 regine	
		if(c.getNrReg()==4)
			r=false;
		return r;
	}
}
